package com.htfyun.database;

import org.geometerplus.android.fbreader.FBReaderApplication;
import org.greenrobot.greendao.database.Database;

/**
 * Created by sst on 2017/12/30.
 */

public enum GreenDaoManager {
    INSTANCE;

    private DaoSession daoSession;

    private GreenDaoManager() {
        if (daoSession != null) {
            return;
        }
        DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(FBReaderApplication.getContext(),"notes-db");
        Database db = helper.getWritableDb();
        daoSession = new DaoMaster(db).newSession();
    }

    public DaoSession getDaoSession() {
        return daoSession;
    }

}
